<html>
<head>
    <meta charset="utf-8">
    <title>测试页</title>
    <link href="https://cdn.bootcss.com/twitter-bootstrap/3.0.1/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <form class="form-horizontal" role="form">
                <div class="form-group">
                    <label for="userName" class="col-sm-2 control-label">用户名</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="userName" name="userName"/>
                    </div>
                </div>
                <div class="form-group">
                    <label for="userPassword" class="col-sm-2 control-label">Password</label>
                    <div class="col-sm-10">
                        <input type="password" class="form-control" id="userPassword" name="userPassword"/>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <div class="checkbox">
                            <label><input type="checkbox" />Remember me</label>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <input id="submit" class="btn btn-default" value="Sign In" />
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<script>
    $("#submit").on("click",function(){
        var username = $("#userName").val();
        var password = $("#userPassword").val();
        $.ajax({
            type: 'POST',
            url:'/igo/user/adduser',
            contentType: "application/json",
            data: {
                "userName": username,
                "userPassword": password
            },
            beforeSend: function() {
                console.log(username);
            },
            success: function (data) {
                console.log(data);
            },
            error: function (e) {
                alert(e);
            }
        });
    })
</script>
</html>
